%% Save file as: HERE.STY               Source: FILESERV@SHSU.BITNET  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\iffalse
                  here.sty
                  %%%%%%%%%%
     here.sty gives environments such as figure and table a [H] option
     which means `PUT IT HERE'. As opposed to the standard [h] option which
     means `You may put it here if you wish'.

                   David Carlisle
                   carlisle@uk.ac.man.cs
                   13 September 1991
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% If you have Mittelbach's doc.sty, this file may be formatted with a
% command like:    latex here.sty
% (You do not need doc.sty to {\em use} this style.)
%
% To create a faster loading .sty file, copy this file to here.doc
% Then remove all the lines beginning with a `%' from the .sty file. This
% may be done with docstrip.tex, or your text editor. The following two
% lines may also be deleted from the .sty file.
\ifcat a\noexpand @\let\next\relax\else\def\next{%
    \documentstyle[here,doc]{article}\MakePercentIgnore}\fi\next
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \textwidth=365pt   ^^A Allow macrocode text with 75 columns.
% \CodelineIndex     ^^A Code lines numbered.
% \DisableCrossrefs  ^^A No Cross references.
%
% \title{here.sty}
% \author{D. P. Carlisle}
% \date{13 Sept 1991}
% \begin{document}
% \maketitle
% \begin{abstract}
% \verb|here.sty| gives environments such as {\tt figure} and {\tt table} a
% {\tt [H]} option  which means `PUT IT HERE'. As opposed to the standard
% {\tt [h]} option which means `You may put it here if you wish'.%
% \end{abstract}
%
% \begin{figure}[H]
% This figure will not float, even if this causes a bad page break.
% \caption{It may be captioned as usual.}
% \end{figure}
%
% Many people have problems with \LaTeX's floating environments. A common
% complaint is that all the environments appear at the end of the document
% (or chapter). Many users try to correct this behaviour by using the {\tt
% [h]} option. Incorect use of this option, in particular using just {\tt
% [h]} rather than a more liberal option such as {\tt [hp]} actually makes
% the problem worse!
%
% \LaTeX\ will only position a float (even one with the {\tt [h]} option)
% in a position which does not violate the rules for float placement set by
% the document style. These rules are determined by the following
% parameters:\\
% \begin{tabular}{ll}
%  \verb|\c@topnumber|&    Number of floats allowed at the top of a
%                          column.\\
%  \verb|\topfraction|&    Fraction of column that can be devoted to
%                          floats.\\
%  \verb|\c@dbltopnumber|\\ \verb|\dbltopfraction|&  Same as above, but for
%                          double-column floats.\\
%  \verb|\c@bottomnumber|\\ \verb|\bottomfraction|&  Same as above for
%                          bottom of page.\\
%  \verb|\c@totalnumber|&  Number of floats allowed in a single column,\\
%                       &  including in-text floats.\\
%  \verb|\textfraction|&   Minimum fraction of column that must contain
%                          text.\\
%  \verb|\floatpagefraction|& Minimum fraction of page that must be taken
%                          up by\\& float page.
% \end{tabular}%
%
% The default settings (in \verb|article.doc| for {\tt article} style) for
% these parameters make it difficult to set floats if the document has a
% lot of small floats. The result is that \LaTeX\ `holds them back' in the
% hope of finding a better place later. At the end of the document (or at a
% \verb|\clearpage|) it gives up and outputs all the remaining floats.
%
% It may be seen from the above paragraph that the `correct' way to handle
% float problems is to write a style file modifying these parameters,
% however for many purposes, authors to not want a float at all, they just
% use the {\tt figure} or {\tt table} environments to get the correct
% spacing, and a counter that may be referenced. This style option
% provides an easy solution in this case. If the {\tt [H]} option is
% specified, the environment will not float even if it causes a bad page
% break, or breaks the rules specified in the above parameters. The main
% drawback is that if the [H] option is used in one figure, and the
% following figure uses the {\tt [t]} option, then the second figure may
% float in front of the first.
%
% Note that the {\tt [H]} should not be used in conjunction with the other
% options. {\tt [Htp]} is not allowed by this style. The {\tt h} option may
% still be used, so {\tt [htp]} is OK.
% \typeout{End of the Introduction and Examples.}
% \typein[\answer]%
%   {Do you want an annotated listing of the macro definitions (y/n) ?}
% \def\next{y}\ifx\answer\next\else\expandafter\stop\fi
%
% \section{The Macros}
% First we make sure that this file is only loaded once.
%    \begin{macrocode}
\ifx\@Hxfloat\@Hundef\else\expandafter\endinput\fi
%    \end{macrocode}
%
% \begin{macro}{\@Hxfloat}
% Now we can save the original version of \verb|\@xfloat|.
%    \begin{macrocode}
\let\@Hxfloat\@xfloat
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@xfloat}
% The new version of \verb|@xfloat| looks for a \verb|[H]| argument.
% If it is present \verb|\@HHfloat| is called, otherwise the original macro
% (renamed to \verb|\@Hfloat|) is called.
%    \begin{macrocode}
\def\@xfloat#1[{\@ifnextchar{H}{\@HHfloat{#1}[}{\@Hxfloat{#1}[}}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\@HHfloat}
% First gobble the \verb|[H]|. Note that {\tt H} should not be used in
% conjunction with the other placement options, nor as the value of the
% default placement, as set in \verb|\fps@|{\it type}.
%    \begin{macrocode}
\def\@HHfloat#1[H]{%
%    \end{macrocode}
% Locally redefine the end of the environment.
%    \begin{macrocode}
\expandafter\let\csname end#1\endcsname\end@Hfloat
%    \end{macrocode}
% Add the vertical space, and define \verb|\caption|. Also reset
% \verb|\parindent| for compatibility with the standard {\tt [h]} option.
%    \begin{macrocode}
\vskip\intextsep\def\@captype{#1}\parindent\z@
%    \end{macrocode}
% The final \verb|\ignorespaces| is needed to gobble any spaces or newlines
% after the {\tt[H]} tokens.
%    \begin{macrocode}
\ignorespaces}
%    \end{macrocode}
% \end{macro}
% \begin{macro}{\end@Hfloat}
% Add the same vertical space as would be added by a float placed with
% {\tt[h]}.
%    \begin{macrocode}
\def\end@Hfloat{\vskip \intextsep}
%    \end{macrocode}
% \end{macro}
% \end{document}
